Socket
Socket
Sign inDemoInstall

@types/d3-format

Package Overview
Dependencies
0
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/d3-format


Version published
Maintainers
1
Install size
17.5 kB
Created

Package description

What is @types/d3-format?

The @types/d3-format package provides TypeScript type definitions for the d3-format module, which is a JavaScript library for formatting numbers for human consumption. It allows developers to format numbers in various ways, such as currency, percentage, precision, and more. The type definitions enable TypeScript developers to use d3-format with type checking and IntelliSense in their IDEs.

What are @types/d3-format's main functionalities?

Number Formatting

Format numbers to a fixed number of decimal places.

import { format } from 'd3-format';
const formatter = format('.2f');
const formattedNumber = formatter(123.456); // '123.46'

Currency Formatting

Format numbers as currency, including symbol, comma separation, and decimal precision.

import { format } from 'd3-format';
const currencyFormatter = format('$,.2f');
const formattedCurrency = currencyFormatter(1234.56); // '$1,234.56'

Percentage Formatting

Format numbers as percentages with rounding and no decimal places.

import { format } from 'd3-format';
const percentFormatter = format('.0%');
const formattedPercent = percentFormatter(0.123); // '12%'

SI Prefix Formatting

Format numbers using SI prefixes with a specified precision.

import { format } from 'd3-format';
const siFormatter = format('.3s');
const formattedSI = siFormatter(123456); // '123k'

Other packages similar to @types/d3-format

Readme

Source

Installation

npm install --save @types/d3-format

Summary

This package contains type definitions for d3-format (https://github.com/d3/d3-format/).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/d3-format/v1.

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Tom Wanzek, Alex Ford, Boris Yankov, denisname, and Nathan Bierema.

FAQs

Last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc